import { http } from "../http";
const baseUrl = "/api/role";

export interface RoleType {
  id: string;
  name: string;
  desc: string;
  defaultRole: boolean;
}

export type GetRoleListQueryType = {
  name?: string;
};

export interface GetRoleListResponseType {
  list: RoleType[];
  currentPage: number;
  numPerPage: number;
  totalCount: number;
}

// 获取角色列表
export const getRoleListAPI = (params: GetRoleListQueryType) => {
  return http.post(`${baseUrl}/getRoleList`, params);
};

// 添加或修改角色
export const addOrUpdateRoleAPI = (params: RoleType) => {
  return http.post(`${baseUrl}/addOrUpdateRole`, params);
};
// 删除角色
export const deleteRoleAPI = (params: { roleIds: string[] }) => {
  return http.post(`${baseUrl}/deleteRole`, params);
};
